<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
use Hyperf\DbConnection\Model\Model;
/**
 * @property int $id 
 * @property string $name 
 * @property int $category_id 
 * @property int $province_id 
 * @property int $city_id 
 * @property int $district_id 
 * @property string $description 
 * @property string $lng 
 * @property string $lat 
 * @property int $admin_id 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property string $deleted_at 
 */
class PointPosition extends Model
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'point_position';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'category_id',
        'province_id',
        'city_id',
        'district_id',
        'description',
        'address',
        'lng',
        'lat',
        'admin_id',
        'main_unit_id'
    ];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'category_id' => 'integer', 'province_id' => 'integer', 'city_id' => 'integer', 'district_id' => 'integer', 'admin_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function category(){
        return $this->belongsTo(PointPositionCategory::class,'category_id','id')->withTrashed();
    }

    public function district(){
        return $this->belongsTo(Area::class,'district_id','id');
    }

    public function mainunit(){
        return $this->belongsTo(CompanyUnit::class,'main_unit_id','id');
    }
}